跳到主要内容

SetTime

Sets the timestamp of the comment creation in the current time zone format.

Syntax

expression.SetTime(nTimeStamp);

expression - A variable that represents a ApiComment class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nTimeStampRequiredNumberString

Returns

ApiComment

Example

This example sets the timestamp of the comment creation in the current time zone format.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is just a sample text");
Api.AddComment(paragraph, "comment", "John Smith");
let comments = doc.GetAllComments();
comments[0].SetTime("1672247153658");
let time = comments[0].GetTime();
paragraph = Api.CreateParagraph();
paragraph.AddText("Comment creation timestamp: " + time);
doc.Push(paragraph);